<script type="text/javascript" src="jquery.js"> </script>		
<script type="text/javascript" src="prototype.js"> </script>
<script type="text/javascript" src="JForm.js"></script>
	<script type="text/javascript">
	dojo.require("dojo.parser");  
	dojo.require("dijit.layout.LinkPane");
     // Load Dojo's code relating to the Button widget
	dojo.require("dijit.Dialog");
	dojo.require("dijit.form.TextBox");
	dojo.require("dijit.form.TimeTextBox");
	dojo.require("dijit.form.Button");
	dojo.require("dijit.form.DateTextBox");
</script>  
<!-- --------------------- -->

<%

	String entId = request.getParameter("enterpriseId");
	//System.out.println("entId = " + entId);
	List contracts = new ArrayList();
	List tmp;
	Set tmp2;
	if (("-1").equals(entId)) {
		tmp = ContractService.$.getAllContracts();
		for (Iterator itr = tmp.iterator(); itr.hasNext();) {
			contracts.add(itr.next());
		}
	} else {
		Enterprise ent = EnterpriseService.$.getEnterpriseById(Integer.parseInt(entId));
		tmp2 = ent.getContracts();
		for (Iterator itr = tmp2.iterator(); itr.hasNext();) {
			contracts.add(itr.next());
		}
	}
	UIutil $ = UIutil.$;
	
	//session id 
	//String userid = (String) session.getValue("user");
	//List contractList = ContractService.$.getAllContracts();
 %>

<fieldset>
	<legend>合同列表</legend>
		<table align="left"  border="1px">
			<thead>
				<tr>
					<th>公司名称</th>
					<th>机构代码</th>
					<th>法人代表</th>
					<th>联系人</th>
					<th>联系电话</th>
					<th>合同金额</th>
					<th>合同起始日期</th>
					<th>合同结束日期</th>
				</tr>
			</thead>
			<tbody>
			<%
				for(int i = 0 ; i < contracts.size(); i++) {
					Contract contract = (Contract) contracts.get(i);	
			%>
				<tr>
					<td><%= contract.getEnterprise().getName()%></td>
					<td><%= contract.getEnterprise().getOrgdeptcode()%></td>
					<td><%= contract.getEnterprise().getRepresentative()%></td>
					<td><a href="javascript:;" onclick="window.location.href='mailto:<%= contract.getContact()%>'"><%= contract.getContact()%></a></td>
					<td><%= contract.getContactNumber()%></td>
					<td><%= contract.getContractAmount()%></td>
					<td><%= contract.getStarteddate()%></td>
					<td><%= contract.getDuedate()%></td>
					
				</tr>	
					
				<%
					}
				%>
				
			</tbody>
		</table>
</fieldset>

<%@ page import="java.util.*" %>
<%@ page import="com.esms.bean.Contract" %>
<%@ page import="com.esms.bean.Enterprise" %>
<%@ page import="com.esms.struts.service.*" %>
<%@ page language="java" contentType="text/html; charset=utf-8" %>